﻿using IoTGateway.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenIotMain.Tools {
    public class PointTool {
        /// <summary>
        /// 生成点位数据
        /// </summary>
        /// <param name="deviceVariableList"></param>
        /// <returns></returns>
       public static Dictionary<string, IoTClient.Enums.DataTypeEnum> Getaddresses(List<DeviceVariable> deviceVariableList) {
            Dictionary<string, IoTClient.Enums.DataTypeEnum> addresses= new Dictionary<string, IoTClient.Enums.DataTypeEnum>();
            foreach (DeviceVariable deviceVariable in deviceVariableList) {
                if (deviceVariable.DataType.Equals("Float")) {
                    addresses.Add(deviceVariable.DeviceAddress, IoTClient.Enums.DataTypeEnum.Float);
                }
                else if (deviceVariable.DataType.Equals("Int32")) {
                    addresses.Add(deviceVariable.DeviceAddress, IoTClient.Enums.DataTypeEnum.Int32);
                }

            }
            return addresses;
        }
    }
}
